﻿using System;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace IFD2
{
    public partial class DepFltPax : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["ACL"].ToString().IndexOf("DA1") < 0)
                {
                    Response.Redirect("unauthorized.aspx");
                }
                //机场服务可能外包给其他公司（如其他航空公司，或机场当局）！

                if (Request.QueryString["flt_no"] != null)
                {
                    lstAirlines.DataBind();
                    lstXferAirline.DataBind();
                    lstAirlines.SelectedValue = Request.QueryString["airline"];
                    lstXferAirline.SelectedValue = Request.QueryString["airline"];
                    txtFltNo.Text = Request.QueryString["flt_no"].ToString();
                    txtFltDate.Text = Convert.ToDateTime(Session["FLT_DATE"].ToString()).ToShortDateString();
                    lbtnQuery_Click(sender, e);
                }
                else
                {
                    if (Session["FLT_NO"] != null)
                        txtFltNo.Text = Session["FLT_NO"].ToString();
                    if (Session["FLT_DATE"] != null)
                        txtFltDate.Text = Convert.ToDateTime(Session["FLT_DATE"].ToString()).ToShortDateString();
                }
                lblDcsAirport.Text = Session["DCS_AIRPORT"].ToString();
                txtOriAirport.Text = lblDcsAirport.Text;
            }

            lblError.Text = "";
            lblError2.Text = "";
            btnSetStatus.Attributes.Add("onclick", "javascript:return confirm('Are you sure?');");
            btnTransfer.Attributes.Add("onclick", "javascript:return confirm('Are you sure?');");
            btnGoShowPax.Attributes.Add("onclick", "javascript:return confirm('Are you sure?');");
        }

        protected void lbtnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime.Parse(txtFltDate.Text);
            }
            catch
            {
                lblError.Text = "Invalid date format!";
                txtFltDate.Text = "";
                return;
            }

            Session["FLT_NO"] = txtFltNo.Text;
            Session["FLT_DATE"] = txtFltDate.Text;
            if (lstStatus.SelectedValue == "N" || lstStatus.SelectedValue == "O")
                panTransfer.Visible = true;
            else
                panTransfer.Visible = false;

            if (lstStatus.SelectedValue == "N")
                panGoshow.Visible = true;
            else
                panGoshow.Visible = false;

            lstXferAirline.SelectedValue = lstAirlines.SelectedValue;
            GridView1.DataBind();
            ctlSeatMatching.compare(lstAirlines.SelectedValue, txtFltNo.Text, Convert.ToDateTime(txtFltDate.Text));
            lblRowCount.Text = GridView1.Rows.Count.ToString();
        }

        protected void btnSetStatus_Click(object sender, EventArgs e)
        {
            if (Session["ACL"].ToString().IndexOf("DB1") < 0)
            {
                lblError.Text = "Unauthorized!";
                return;
            }
            int ret_code;
            string key;
            string[] strArray;
            if (Request.Form["KEY"] == null)
            {
                lblError.Text = "Please select a record.";
                return;
            }
            key = Request.Form["KEY"];
            strArray = key.Split('|');
            //string[] strArray2;
            //if (Request.Form["SEAT"] == null)
            //    return;
            //key = Request.Form["SEAT"];
            //strArray2 = key.Split('|');

            SqlCommand cmd = new SqlCommand();
            lblError.Text = "";

            cmd.CommandText = "bll_tkt_force_set_departure_status";
            SqlParameter para = cmd.Parameters.AddWithValue("@bk_id", strArray[0]);
            para = cmd.Parameters.AddWithValue("@pax_sn", strArray[1]);
            para = cmd.Parameters.AddWithValue("@trip_sn", strArray[2]);
            para = cmd.Parameters.AddWithValue("@new_status", lstStatus2.SelectedValue);
            //para = cmd.Parameters.AddWithValue("@seat_row", 100);//strArray2[0]);
            //para = new SqlParameter("@seat_col", SqlDbType.Char, 1);
            //para.Value = "Z";// strArray2[1];
            //cmd.Parameters.Add(para);
            para = cmd.Parameters.AddWithValue("@user_airline", Session["AIRLINE"].ToString());
            para = cmd.Parameters.AddWithValue("@office", Session["OFFICE"].ToString());
            para = cmd.Parameters.AddWithValue("@user", Session["USER"].ToString());
            para = cmd.Parameters.AddWithValue("@ip_addr", Request.UserHostAddress.ToString());
            try
            {
                ret_code = TinyDAL.Exec(ref cmd);
                switch (ret_code)
                {
                    case 0:
                        lblError.Text = "OK.";
                        GridView1.DataBind();
                        break;
                    case 1:
                        lblError.Text = "Trip not found!";
                        break;
                    case 2:
                        lblError.Text = "Flight not open for checking-out!";
                        break;
                    case 3:
                        lblError.Text = "Please use check-in interface to check-in!";
                        break;
                    case 4:
                        lblError.Text = "Please check-out all luggage first!";
                        break;
                    case 11:
                        lblError.Text = "Update tickets departure status failed!";
                        break;
                    case 12:
                        lblError.Text = "Release original seat failed!";
                        break;
                    case 13:
                        lblError.Text = "Check-out failed!";
                        break;
                    case 14:
                        lblError.Text = "Change status failed!";
                        break;
                    case 50:
                        lblError.Text = "Can not handle unauthorized airline ticket!";
                        break;
                    default:
                        lblError.Text = "Error " + ret_code.ToString() + "! Contact system adminstartor!";
                        break;
                }
            }
            catch (Exception ex)
            {
                if (Application["DEBUG"].ToString() == "1")
                    lblError.Text = ex.Message;
                else
                    lblError.Text = "Unexpected error! Please recheck the input/output data first. If the error appears again, contact adminstrator with your operating details please.";
            }


        }
        protected void btnSetSeatType_Click(object sender, EventArgs e)
        {
            if (Session["ACL"].ToString().IndexOf("DB2") < 0)
            {
                lblError.Text = "Unauthorized!";
                return;
            }
            txtSeatType.Text = txtSeatType.Text.Trim();
            if (txtSeatType.Text.Length == 0)
            {
                lblError.Text = "Please input seat type!";
                return;
            }
            int ret_code;
            string key;
            string[] strArray;
            if (Request.Form["KEY"] == null)
            {
                lblError.Text = "Please select a record.";
                return;
            }
            key = Request.Form["KEY"];
            strArray = key.Split('|');
            //string[] strArray2;
            //if (Request.Form["SEAT"] == null)
            //    return;
            //key = Request.Form["SEAT"];
            //strArray2 = key.Split('|');

            SqlCommand cmd = new SqlCommand();
            lblError.Text = "";

            cmd.CommandText = "bll_tkt_set_seat_type";
            SqlParameter para = cmd.Parameters.AddWithValue("@bk_id", strArray[0]);
            para = cmd.Parameters.AddWithValue("@pax_sn", strArray[1]);
            para = cmd.Parameters.AddWithValue("@trip_sn", strArray[2]);
            para = cmd.Parameters.AddWithValue("@seat_type", txtSeatType.Text.ToUpper());
            //para = cmd.Parameters.AddWithValue("@seat_row", 100);//strArray2[0]);
            //para = new SqlParameter("@seat_col", SqlDbType.Char, 1);
            //para.Value = "Z";// strArray2[1];
            //cmd.Parameters.Add(para);
            para = cmd.Parameters.AddWithValue("@airline", Session["AIRLINE"].ToString());
            para = cmd.Parameters.AddWithValue("@office", Session["OFFICE"].ToString());
            para = cmd.Parameters.AddWithValue("@user", Session["USER"].ToString());
            para = cmd.Parameters.AddWithValue("@ip_addr", Request.UserHostAddress.ToString());
            try
            {
                ret_code = TinyDAL.Exec(ref cmd);
                switch (ret_code)
                {
                    case 0:
                        lblError.Text = "Done.";
                        GridView1.DataBind();
                        break;
                    case 1:
                        lblError.Text = "Setting failed!";
                        break;
                    default:
                        lblError.Text = "Error:" + ret_code.ToString() + "!";
                        break;
                }
            }
            catch (Exception ex)
            {
                if (Application["DEBUG"].ToString() == "1")
                    lblError.Text = ex.Message;
                else
                    lblError.Text = "Unexpected error! Please recheck the input/output data first. If the error appears again, contact adminstrator with your operating details please.";
            }
        }
        protected void btnRetreive2_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime.Parse(txtFltDateXfer.Text);
            }
            catch
            {
                lblErrTransfer.Text = "Invalid date format!";
                txtFltDateXfer.Text = "";
                return;
            }
            //hidFltNoXfer.Value = txtFltNoXfer.Text;
            //hidFltDateXfer.Value = txtFltDateXfer.Text;
            lstOri.DataBind();
            lstDes.DataBind();
        }
        protected void lstOri_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstCabins.DataBind();
        }
        protected void lstDes_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstCabins.DataBind();
        }
        protected void lstCabins_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstClasses.DataBind();
        }
        protected void btnTransfer_Click(object sender, EventArgs e)
        {
            //transfer=block seat!
            if (Session["ACL"].ToString().IndexOf("DB3") < 0)
            {
                lblErrTransfer.Text = "Unauthorized!";
                return;
            }
            int ret_code;
            //string key;
            //string[] strArray;
            //if (Request.Form["KEY"] != null)
            //{
            //    key = Request.Form["KEY"];
            //    strArray = key.Split('|');
            //    txtPaxTktNums.Text = txtPaxTktNums.Text.Trim();
            //    if (txtPaxTktNums.Text == "")
            //        txtPaxTktNums.Text = (Convert.ToInt64(strArray[0]) * 1000 + Convert.ToInt32(strArray[1])).ToString();
            //}
            //strArray = txtPaxTktNums.Text.Split(',');
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "bll_flt_batch_transfer_pax";
            SqlParameter para;
            string ori_ori_airport = "", ori_des_airport = "";

            StringBuilder orders = new StringBuilder();
            StringBuilder pax_ids = new StringBuilder();
            //StringBuilder trip_sns = new StringBuilder();//同一批签转硬挨始发目的相同，所以不用trip_sn
            //StringBuilder tkt_list = new StringBuilder();
            int pax_count = 0;
            lblErrTransfer.Text = "";
            CheckBox cbox;

            //改为一次sql：select * from tkt_root where (bk_id*1000+pax_sn) in ((90000903414*1000+1),(90000903451*1000+2))，旅客序号不能超过999！trip_sn不能超过9！单SQL不能记录机票操作记录，不用此法！
            //for (int i = 0; i < strArray.Length; i++)
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                cbox = (CheckBox)GridView1.Rows[i].Cells[1].FindControl("select");
                if (cbox.Checked)
                {
                    pax_count++;
                    //tkt_list.Append((Convert.ToInt64(GridView1.DataKeys[i]["bk_id"]) * 10000 + Convert.ToInt64(GridView1.DataKeys[i]["pax_sn"]) * 10 + Convert.ToInt64(GridView1.Rows[i].Cells[14].Text)).ToString() + ",");


                    //tktno = (Convert.ToInt64(GridView1.DataKeys[i]["bk_id"].ToString()) * 1000 + Convert.ToInt64(GridView1.DataKeys[i]["pax_sn"].ToString())).ToString();
                    orders.Append(GridView1.DataKeys[i]["bk_id"].ToString() + ",");
                    pax_ids.Append(GridView1.DataKeys[i]["pax_sn"].ToString() + ",");
                    //trip_sns.Append(GridView1.DataKeys[i]["trip_sn"].ToString() + ",");
                    ori_ori_airport = GridView1.Rows[i].Cells[5].Text;//ori_airport
                    ori_des_airport = GridView1.Rows[i].Cells[6].Text;//des_airport
                }
            }
            if (pax_count == 0 || pax_count > 50) //一次最多迁转50名旅客！
            {
                lblErrTransfer.Text = "Please check passengers, or passengers are more than 50.";
                return;
            }
            try
            {
                cmd.Parameters.Clear();
                //para = cmd.Parameters.AddWithValue("@tkt_list", tkt_list.ToString());
                para = cmd.Parameters.AddWithValue("@order_buf", orders.ToString());
                para = cmd.Parameters.AddWithValue("@pax_buf", pax_ids.ToString());
                para = cmd.Parameters.AddWithValue("@pax_count", pax_count);
                para = cmd.Parameters.AddWithValue("@ori_airline", lstAirlines.SelectedValue);
                para = cmd.Parameters.AddWithValue("@ori_flt_no", txtFltNo.Text);
                para = cmd.Parameters.AddWithValue("@ori_flt_date", txtFltDate.Text);
                para = cmd.Parameters.AddWithValue("@ori_ori_airport", ori_ori_airport);
                para = cmd.Parameters.AddWithValue("@ori_des_airport", ori_des_airport);
                para = cmd.Parameters.AddWithValue("@target_airline", lstXferAirline.SelectedValue);
                para = cmd.Parameters.AddWithValue("@target_flt_no", txtFltNoXfer.Text);
                para = cmd.Parameters.AddWithValue("@target_flt_date", txtFltDateXfer.Text);
                para = cmd.Parameters.AddWithValue("@ori_airport", lstOri.SelectedValue);
                para = cmd.Parameters.AddWithValue("@des_airport", lstDes.SelectedValue);
                para = cmd.Parameters.AddWithValue("@cabin", lstCabins.SelectedValue);
                para = cmd.Parameters.AddWithValue("@class", lstClasses.SelectedValue);
                para = cmd.Parameters.AddWithValue("@user", Session["USER"].ToString());
                para = cmd.Parameters.AddWithValue("@office", Session["OFFICE"].ToString());
                para = cmd.Parameters.AddWithValue("@user_airline", Session["AIRLINE"].ToString());
                para = cmd.Parameters.AddWithValue("@ip_addr", Request.UserHostAddress.ToString());

                ret_code = TinyDAL.Exec(ref cmd);
                switch (ret_code)
                {
                    case 0:
                        lblErrTransfer.Text = "Done.";
                        GridView1.DataBind();
                        break;
                    case 1:
                        lblErrTransfer.Text = "Origin city not found!";
                        return;
                    case 2:
                        lblErrTransfer.Text = "Destination city not found!";
                        return;
                    case 3:
                        lblErrTransfer.Text = "Getting target flight departure time failed!";
                        return;
                    case 4:
                        lblErrTransfer.Text = "Ticket trip not found!";
                        return;
                    case 5:
                        lblErrTransfer.Text = "Target flight not found or impertinent status!";
                        return;
                    case 6:
                        lblErrTransfer.Text = "Original flight not found or impertinent status!";
                        return;
                    //case 8:
                    //    签转目标子舱为候补状态，需目标航空公司确认接收旅客，所以不限制签转目标航空公司。而且只要签署签转协议，均可签转，而系统中不记录签转关系，所以开放签转。
                    //    lblError.Text =strArray[i]+": Can not transfer other airline passenger!";
                    //    break;
                    case 10:
                        lblErrTransfer.Text = "Changing ticket flight failed!";
                        return;
                    case 13:
                        lblErrTransfer.Text = "Block target flight cabin faild!";
                        return;
                    case 14:
                        lblErrTransfer.Text = "Block target flight class faild!";
                        return;
                    case 50:
                        lblErrTransfer.Text = "Unauthorized airline!";
                        return;
                    case 300:
                        lblErrTransfer.Text = "Parse order buffer failed!";
                        return;
                    case 301:
                        lblErrTransfer.Text = "Parse pax buffer failed!";
                        return;
                    default:
                        lblErrTransfer.Text = "Error=" + ret_code.ToString() + "!";
                        return;
                }
                return;
            }
            catch (Exception ex)
            {
                if (Application["DEBUG"].ToString() == "1")
                    lblErrTransfer.Text = ex.Message;
                else
                    lblErrTransfer.Text = "Unexpected error! Please recheck the input/output data first. If the error appears again, contact adminstrator with your operating details please.";
                return;
            }

        }


        protected void lstXferAirline_DataBound(object sender, EventArgs e)
        {
            lstXferAirline.SelectedValue = Session["AIRLINE"].ToString();
        }
        protected void btnChange_Click(object sender, EventArgs e)
        {
            if (Session["ACL"].ToString().IndexOf("DB2") < 0)
            {
                lblErrChange.Text = "Unauthorized!";
                return;
            }

            int ret_code;
            SqlCommand cmd = new SqlCommand();
            lblErrChange.Text = "";
            try
            {
                cmd.CommandText = "bll_flt_batch_set_tkt_seat_type";
                SqlParameter para = cmd.Parameters.AddWithValue("@op_airline", lstAirlines.SelectedValue);
                para = cmd.Parameters.AddWithValue("@op_flt_no", txtFltNo.Text);
                para = cmd.Parameters.AddWithValue("@flt_date", txtFltDate.Text);
                para = cmd.Parameters.AddWithValue("@airport", Session["DCS_AIRPORT"].ToString());
                //para = cmd.Parameters.AddWithValue("@is_group", chkIsGroup.Checked);
                para = cmd.Parameters.AddWithValue("@dcs_status", lstStatus.SelectedValue);
                para = cmd.Parameters.AddWithValue("@new_seat_type", txtNewValue.Text);
                para = cmd.Parameters.AddWithValue("@where_clause", txtWhere.Text);
                para = cmd.Parameters.AddWithValue("@user", Session["USER"].ToString());
                para = cmd.Parameters.AddWithValue("@office", Session["OFFICE"].ToString());
                para = cmd.Parameters.AddWithValue("@user_airline", Session["AIRLINE"].ToString());
                para = cmd.Parameters.AddWithValue("@ip_addr", Request.UserHostAddress.ToString());

                ret_code = TinyDAL.Exec(ref cmd);
                if (ret_code == 0)
                {
                    lblErrChange.Text = "Done.";
                    GridView1.DataBind();
                    ctlSeatMatching.compare(lstAirlines.SelectedValue, txtFltNo.Text, Convert.ToDateTime(txtFltDate.Text));
                    return;
                }
                else if (ret_code == 1)
                    lblErrChange.Text = "Illegal verbs";
                else if (ret_code == 2)
                    lblErrChange.Text = "Unauthorized airline!";
                //else if (ret_code == 3)
                //    lblErrChange.Text = "!";
                else if (ret_code == 4)
                    lblErrChange.Text = "Updating failed!";
                else
                    lblErrChange.Text = "Error:" + ret_code.ToString();
            }
            catch (Exception ex)
            {
                if (Application["DEBUG"].ToString() == "1")
                    lblErrChange.Text = ex.Message;
                else
                    lblErrChange.Text = "Unexpected error! Please recheck the input/output data first. If the error appears again, contact adminstrator with your operating details please.";
            }
        }


        protected void btnGoShowPax_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime.Parse(txtExpiry.Text);
                DateTime.Parse(txtFltDate.Text);
                if (txtInfantDob.Text != "")
                    DateTime.Parse(txtInfantDob.Text);

            }
            catch
            {
                lblError2.Text = "Invalid date format!";
                return;
            }

            if (Session["ACL"].ToString().IndexOf("DB4") < 0)
            {
                lblError2.Text = "Unauthorized!";
                return;
            }
            int ret_code;
            //string key;
            //string[] strArray;
            //if (Request.Form["KEY"] == null)
            //{
            //    lblError2.Text = "Please select flight.";
            //    return;
            //}
            //key = Request.Form["KEY"];
            //strArray = key.Split('|');

            txtFamilyNameEn.Text = txtFamilyNameEn.Text.Trim();
            if (txtFamilyNameEn.Text == "")
            {
                lblError2.Text = "Please input pax family name(en)!";
                return;
            }
            txtNameEn.Text = txtNameEn.Text.Trim();
            if (txtNameEn.Text == "")
            {
                lblError2.Text = "Please input pax name(en)!";
                return;
            }
            txtIdNo.Text = txtIdNo.Text.Trim();
            if (txtIdNo.Text == "")
            {
                lblError2.Text = "Please input pax ID number!";
                return;
            }
            txtInfantDob.Text = txtInfantDob.Text.Trim();
            if (lstAgeType.SelectedValue == "I" && txtInfantDob.Text == "")
            {
                lblError2.Text = "Infant's birthday is needed!";
                return;
            }
            bool male;
            SqlCommand cmd = new SqlCommand();
            lblError2.Text = "";
            cmd.CommandText = "bll_flt_add_pax_for_go_show";
            SqlParameter para = cmd.Parameters.AddWithValue("@flt_date", txtFltDate.Text);
            para = cmd.Parameters.AddWithValue("@airline", lstAirlines.SelectedValue);
            para = cmd.Parameters.AddWithValue("@flt_no", txtFltNo.Text);
            para = cmd.Parameters.AddWithValue("@ori_airport", txtOriAirport.Text);//strArray[3]
            para = cmd.Parameters.AddWithValue("@des_airport", lstDesAirport.SelectedValue);//strArray[3]
            para = cmd.Parameters.AddWithValue("@cabin", lstCabin.SelectedValue);
            para = cmd.Parameters.AddWithValue("@class", lstClass.SelectedValue);
            para = cmd.Parameters.AddWithValue("@age_type", lstAgeType.SelectedValue);
            if (radFemale.Checked)
                male = false;
            else if (radMale.Checked)
                male = true;
            else
            {
                lblError2.Text = "Please check gender!";
                return;
            }
            para = cmd.Parameters.AddWithValue("@male", male);
            para = cmd.Parameters.AddWithValue("@family_name", txtFamilyName.Text);
            para = cmd.Parameters.AddWithValue("@name", txtName.Text);
            para = cmd.Parameters.AddWithValue("@family_name_en", txtFamilyNameEn.Text);
            para = cmd.Parameters.AddWithValue("@name_en", txtNameEn.Text);
            para = cmd.Parameters.AddWithValue("@inf_dob", txtInfantDob.Text);
            para = cmd.Parameters.AddWithValue("@nationality", lstNations.SelectedValue);
            para = cmd.Parameters.AddWithValue("@id_type", lstIdTypes.SelectedValue);
            para = cmd.Parameters.AddWithValue("@id_no", txtIdNo.Text);
            para = cmd.Parameters.AddWithValue("@id_expiry", txtExpiry.Text);
            para = cmd.Parameters.AddWithValue("@mobile_phone", txtPhone.Text);
            para = cmd.Parameters.AddWithValue("@email", txtEmail.Text);
            para = cmd.Parameters.AddWithValue("@user", Session["USER"].ToString());
            para = cmd.Parameters.AddWithValue("@office", Session["OFFICE"].ToString());
            para = cmd.Parameters.AddWithValue("@user_airline", Session["AIRLINE"].ToString());
            para = cmd.Parameters.AddWithValue("@ip_addr", Request.UserHostAddress.ToString());
            para = cmd.Parameters.Add("@bk_id", SqlDbType.BigInt);
            para.Direction = ParameterDirection.Output;
            try
            {
                ret_code = TinyDAL.Exec(ref cmd);
                switch (ret_code)
                {
                    case 0:
                        lblError2.Text = "OK. Order Number is:" + para.Value.ToString(); ;
                        GridView1.DataBind();
                        break;
                    case 1:
                        lblError2.Text = "Get order id failed!";
                        break;
                    case 2:
                        lblError2.Text = "Ori airport not found!";
                        break;
                    case 3:
                        lblError2.Text = "Des airport not found!";
                        break;
                    case 4:
                        lblError2.Text = "Flight not found!";
                        break;
                    case 5:
                        lblError2.Text = "Flight not open for checking-in!";
                        break;
                    case 6:
                        lblError2.Text = "Please input infant's birthday!";
                        break;
                    case 7:
                        lblError2.Text = "Flight segment not found!";
                        break;
                    case 30:
                        lblError2.Text = "Update flight inventory failed!";
                        break;
                    case 31:
                        lblError2.Text = "Insert tkt_root failed!";
                        break;
                    case 32:
                        lblError2.Text = "Insert tkt_trip failed!";
                        break;
                    case 33:
                        lblError2.Text = "Calculate nested avail failed!";
                        break;
                    default:
                        lblError2.Text = "Error:" + ret_code.ToString();
                        break;
                }
            }
            catch (Exception ex)
            {
                if (Application["DEBUG"].ToString() == "1")
                    lblError2.Text = ex.Message;
                else
                    lblError2.Text = "Unexpected error! Please recheck the input/output data first. If the error appears again, contact adminstrator with your operating details please.";
            }
        }
        protected void lstAgeType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstAgeType.SelectedValue == "I")
            {
                lblInfDOB.Visible = true;
                txtInfantDob.Visible = true;
            }
            else
            {
                lblInfDOB.Visible = false;
                txtInfantDob.Visible = false;
            }
        }
    }
}